﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpDwgDxfInterface.h"
#include "IDrawingHiddenLineRemovalResult.h"

namespace gcmp
{
    class Coordinate3d;
    class IGraphicsCurve3d;
    class IGraphicsBRepBody;

    class IProgressReporter;

    class GCMP_DWG_DXF_INTERFACE_EXPORT IDrawingHiddenLineRemoval
    {
    public:
        /// \brief 计算消隐后的线和区域;
        ///
        /// \param[in]  coordinate3d 观察坐标系(沿Z轴负向看);
        /// \param[in]  graphicsBRepBodies 传入的IGraphicsBRepBody
        /// \param[in]  graphics3dCurves 传入的IGraphicsCurve3d
        /// \param[out] visibleOpCurves 输出消隐后的可见线;
        /// \param[in]  bNeedHiddenLine 是否计算隐藏线;
        /// \param[out] hiddenOpCurves 输出消隐后的不可见线;
        /// \param[in]  bNeedHLRRegion 是否计算消隐后的区域;
        /// \param[in]  bMergeFace 是否合并消隐后的区域;
        /// \param[in]  dRegionSearchEps 搜索消隐区域的容差;
        /// \param[out] outRegions 输出消隐后的区域;
        /// \param[in]  bHLRAcc 是否开启消隐加速;
        /// \param[in]  pProgressReporter 进度报告器，不关心可以传null;
        /// \param[in]  dRegionRepaireEps 消隐区域的修复精度，精度越小越精确。一般情况采用GGP默认值即可，对于模型存在误差时可设置该值;
        /// \return 成功返回true,否则返回false;
        static bool CalculateHiddenLineRemoval(const gcmp::Coordinate3d& coordinate3d,
            const std::vector<const gcmp::IGraphicsBRepBody*>& graphicsBRepBodies, const std::vector<const gcmp::IGraphicsCurve3d*>& graphics3dCurves,
            std::vector<gcmp::GcmpHLROutLinePtr>& visibleOpCurves, bool bNeedHiddenLine, std::vector<gcmp::GcmpHLROutLinePtr>& hiddenOpCurves,
            bool bNeedHLRRegion, bool bMergeFace, double dRegionSearchEps, std::vector<gcmp::GcmpHLROutRegionPtr>& outRegions, bool bHLRAcc, gcmp::IProgressReporter* pProgressReporter, double dRegionRepaireEps = 10.0);
    };
}